package com.cn.why.film.filmindex.face.thread;

/**
 * volatile关键字实现单例模式（默认为饿汉式）
 */
public class SingleByVolatile {
    public static int a = 6;
    private SingleByVolatile(){ }
    //成员内部类
    private  static class singleHodler{
        //创建自己
        private static volatile SingleByVolatile instance = new SingleByVolatile();
    }

    public static SingleByVolatile getStance(){
        return singleHodler.instance;
    }

}
